package modelTest;

import static org.junit.Assert.*;
import model.Item;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests the Item class
 * 
 * @author Daniel Bartholomew
 */
public class ItemTest {
	
	private String testName = "TestItem";
	
	private double testPrice = 50;
	
	private String testNotes = "Not very interesting";
	
	private Item testItem;
	
	@Before
	public void initialize() {
		testItem = new Item(testName, testPrice, testNotes);
	}
	
	@Test
	public void testItemCreation() {
		assertEquals("Name Test", testName, testItem.getName());
		assertEquals("Price Test", testPrice, testItem.getMinPrice(), .005);
		assertEquals("Note Test", testNotes, testItem.getNotes());
	}
	
	@Test
	public void testIDs() {
		int startingID = testItem.getID();

		Item testItem1 = new Item(testName, testPrice, testNotes);
		Item testItem2 = new Item(testName, testPrice, testNotes);
		Item testItem3 = new Item(testName, testPrice, testNotes);
		
		assertEquals("ID Test 1", startingID + 1, testItem1.getID());
		assertEquals("ID Test 2", startingID + 2, testItem2.getID());
		assertEquals("ID Test 3", startingID + 3, testItem3.getID());
	}
	
}
